// /home/kev/Projects/mono/GtkTester/GtkTester/GtkTest/GtkTest/Main.cs created with MonoDevelop
// User: kev at 15:02 10/08/2007
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//
// project created on 10/08/2007 at 15:02
using System;
using System.Diagnostics;
using System.Threading;
using Gtk;
using Glade;

namespace GtkTest
{
    public class GladeApp
    {
        //private static GtkTest.MessageOut mainDialog;
    	public static void Main (string[] args)
    	{
            bool firstInstance = false;
            Mutex mutex = new Mutex(false, "easyChatApplication", out firstInstance);
            Application.Init();

            if(firstInstance)
            {
                //new GtkTest.MainWindow();
                new GtkTest.MessageOut();
//              mainDialog = new GtkTest.MessageOut();
//              mainDialog.Modal = true;
//              Console.WriteLine("Dialog is " + mainDialog.Modal.ToString());
//              mainDialog.Run();
                Console.WriteLine("Returned to main entry point");
            }
            else
            {
                string procName = Process.GetCurrentProcess().ProcessName;
                using(MessageDialog se = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Close,
                                                      "Application " + procName + " is already running"))
                {
                    se.Run();
                    se.Destroy();                        
                }
            }
    	}
    }
}